package com.oracle.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.oracle.Service.impl.OrdersService;
import com.oracle.dao.impl.OrderItemDao;
import com.oracle.dao.impl.OrdersDao;
import com.oracle.mapper.OrderitemMapper;
import com.oracle.pojo.Orderitem;
import com.oracle.pojo.Orders;
import com.oracle.pojo.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.sql.JDBCType;
import java.util.Date;
import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    private OrdersDao ordersDao;


    @Override
    public Page<Orders> selectOrders(Integer currentPage, Integer pageSize, OrderVo orderVo) {
        Page<Orders> pages = PageHelper.startPage(currentPage, pageSize);
        ordersDao.selectOrders(orderVo);
        return pages;
    }

    @Override
    public List<Orders> findSomeByUid(Integer uid) {
        return ordersDao.findSomeByUid(uid);
    }

    @Override
    public Orders addNewOrder(BigDecimal total, Date date, Integer uid) {
        return ordersDao.addNewOrder(total,date,uid);
    }

    @Override
    public Integer deleteOrdersByOid(Integer oid) {
        return ordersDao.deleteOrdersByOid(oid);
    }

    @Override
    public Integer selectPayCodeByOid(Integer oid) {
        return ordersDao.selectPayCodeByOid(oid);
    }

    @Override
    public Integer updateOrdersPayCodeByOid(int oid) {
        return ordersDao.updateOrdersPayCodeByOid(oid);
    }
}
